package net.lab1024.sa.admin.module.business.roland.constant;


import lombok.Getter;
import net.lab1024.sa.common.common.enumeration.BaseEnum;

import java.util.Arrays;

/**
 * 座位区域
 *
 * @Author 1024创新实验室: 开云
 * @Date 2022/7/28 20:37:15
 * @Wechat zhuoda1024
 * @Email lab1024@163.com
 * @Copyright 1024创新实验室 （ https://1024lab.net ），2012-2022
 */
public enum SeatAreaEnum implements BaseEnum {
    // 11左前，12左后，21中前，22中后，31右前，32右后
    LEFT_FRONT(1, 11, "左前"),
    LEFT_BACK(1, 12, "左后"),
    MIDDLE_FRONT(2, 21, "中前"),
    MIDDLE_BACK(2, 22, "中后"),
    RIGHT_FRONT(3, 31, "右前"),
    RIGHT_BACK(3, 32, "右后"),
    ;

    @Getter
    private Integer area;
    private Integer value;
    private String desc;

    SeatAreaEnum(Integer area, Integer value, String desc) {
        this.area = area;
        this.value = value;
        this.desc = desc;
    }

    public static SeatAreaEnum valueOf(Integer value) {
        if (value == null) {
            return null;
        }
        return Arrays.stream(values())
                .filter(v -> v.getValue().equals(value))
                .findFirst()
                .orElse(null);
    }

    @Override
    public Integer getValue() {
        return value;
    }

    @Override
    public String getDesc() {
        return desc;
    }
}
